package com.jmp.api.controller;

import com.jmp.base.LogApi;
import com.jmp.base.dto.LogAddRequest;
import one.stand.mapper.AdminRecordMapper;
import one.stand.model.AdminRecordModel;
import one.stand.model.ResultModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogController implements LogApi {
    @Autowired
    private AdminRecordMapper adminRecordMapper;

    @Override
    public ResultModel add(@RequestBody LogAddRequest request) {

        AdminRecordModel adminRecordModel = new AdminRecordModel();
        adminRecordModel.setAdminId(request.getUserId());
        adminRecordModel.setCompanyId(request.getCompanyId());
        adminRecordModel.setOperationId(request.getType());
        adminRecordModel.setContent(request.getContent());
        adminRecordModel.setCreateTime(request.getDate());
        adminRecordMapper.insertSelective(adminRecordModel);

        return ResultModel.success();
    }
}
